package com.yuju.controller.hotel;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.yuju.common.Result;
import com.yuju.controller.base.BaseController;
import com.yuju.enums.ReturnCodeEnum;
import com.yuju.enums.ReturnStatusEnum;
import com.yuju.order.enums.ReserveReturnCodeEnum;
import com.yuju.order.model.RoomOrderModel;
import com.yuju.order.service.IRoomOrderService;
import com.yuju.util.Utils;
import com.yuju.vo.order.RoomOrderVO;


@Controller
@RequestMapping("dueOut")
public class DueOutController  extends BaseController<RoomOrderVO, RoomOrderModel>{

	@Autowired
	private IRoomOrderService roomOrderService;
	
	
	@RequestMapping("selectDueOutByDate")
	@ResponseBody
	public Result name(@RequestBody JSONObject obj) {
		RoomOrderVO roomOrderVO = obj.toJavaObject(RoomOrderVO.class);
		Result result = new Result();
		List<RoomOrderModel> list = roomOrderService.dueOut(convert(roomOrderVO));
		if (Utils.isNotNull(list) && Utils.isNotNull(list)) {
			result.setRows(list);
			result.setStatus(ReturnStatusEnum.SUCCESS.getCode());
			result.setMsg(ReturnStatusEnum.SUCCESS.getDesc());
			result.setReturnCode(ReserveReturnCodeEnum.RESERVE_QUERY_SUCCESS.getCode());
			result.setReturnMsg(ReserveReturnCodeEnum.RESERVE_QUERY_SUCCESS.getDesc());
		} else {
			result = new Result();
			result.setStatus(ReturnStatusEnum.FAILURE.getCode());
			result.setMsg(ReturnStatusEnum.FAILURE.getDesc());
			result.setReturnCode(ReturnCodeEnum.NO_DATA.getCode());
			result.setReturnMsg(ReturnCodeEnum.NO_DATA.getDesc());
		}
		return result;
	}
	
}
